# 顺序语句 ---就是一行行代码往下
# print("hello")
# print("the")
# print("world")

# 条件语句
# 判断一个数是奇数还是偶数
# num = input("请输入一个数字：")
# num = int(num)
# if num % 2 == 1:
#     print("奇数")
# else:
#     print("偶数")

# 在python中%负数的余数也是正数
# num = int(input("输入一个数字"))
# if num % 2 == 1:
#     print("奇数")
# else:
#     print("偶数")
# if语句
# if 条件 ：
#     要执行的语句

# if else语句
# 判断一个数字的正负

# num = int(input("请输入一个数字:"))
# if num > 0:
#     print("正数")
# elif num < 0:
#     print("负数")
# else:
#     print("0")

# 缩进和代码块

# num = int(input("please input a number:"))
# if num > 0:
#     print("hahaha")
# print("hello world!")

# 判断闰年
# year = int(input("please input a year:"))
# if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
#     print("闰年")
# else:
#     print("no")

# if 的嵌套
# num = int(input("please input a number:"))
# if num > 0:
#     if num % 2 == 0:
#         print("yes")
#     else:
#         print("no")
# else:
#     print("hehehe")

# 空语句 pass

# num = input("please input a number")
# num = int(num)
# if num % 2 == 0:
#     pass
# else:
#     print("ok")
# yd

# 循环语句
# while
# while 条件 :
#     想要执行的语句
#     调整
# 计算1+2+3+4+ ------ + 100

# num: int = 1
# thesum = 0
# while num <= 100:
#     thesum += num
#     num += 1
# print(thesum)

# for循环
# for i in range()
#     想要执行的语句

# 计算1+2+3+4+ ------ + 100

# sum = 0
# for i in range(1,101):
#     sum += i
# print(f"sum = {sum}")

# if else while for 全都需要：

# 1! + 2! + 3! + ---- + 9!

# # (1)while
# count = 1
# thesum = 0
# while count <= 9:
#     i = 1
#     num = 1
#     while i <= count:
#         num *= i
#         i += 1
#     thesum += num
#     count += 1
#
# print(thesum)

# (2)for

# thesum = 0
# for i in range(1, 10):
#     num = 1
#     for k in range(1, i + 1):
#         num *= k
#     thesum += num
#
# print(thesum)

# continue and break

# num = 0
# while num <= 5:
#     num += 1
#     if num == 3:
#         continue
#     print(f"eating {num}")

# num = 0
# while num <= 5:
#     num += 1
#     if num == 3:
#         break
#     print(f"eating {num}")
#
